/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.raster.grid.data;

import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
/**
 * @author chunquedong
 * 
 */
public class FileImageData implements GridDataSource{

	private String rootPath;
	private String formatName = "jpeg";

	@Override
	public Image getData(String grid,String name) throws IOException {
		String path=rootPath+File.separator
					+grid+File.separator
					+name+ "." + formatName;
		File file=new File(path);
		return ImageIO.read(file);
	}
	
	public String getFormatName() {
		return formatName;
	}

	public void setFormatName(String formatName) {
		this.formatName = formatName;
	}

	public String getRootPath() {
		return rootPath;
	}

	public void setRootPath(String rootPath) {
		this.rootPath = rootPath;
	}
}